//
// Created by YxMin on 2024/7/4.
//

#ifndef GAME_BLOCK_H
#define GAME_BLOCK_H
#include "Element.h"
#include <easyx.h>

class Block :public Element {
private:
    COLORREF fillColor;
public:
    Block(int uid, int x1, int y1, int x2, int y2,int radius = 0, int (*callback)(void *) = nullptr,COLORREF fillColor = WHITE)
            : Element(uid, x1, y1, x2,y2,radius, callback) {
        this->fillColor = fillColor;
    }
    ~Block() override = default;
    void draw() override {
        setfillcolor(fillColor);
        if(radius > 0) {
            fillroundrect(area.left,area.top,area.right,area.bottom,radius,radius);
        } else {
            fillrectangle(area.left,area.top,area.right,area.bottom);
        }
        setfillcolor(WHITE);
    }
};


#endif //GAME_BLOCK_H
